	#include<iostream>
	#include<cmath>
	#include<string>
	using namespace std;
	int main()
	{
		int a=0,b=0;
		string c;
		//gets(c);
		cin>>c;
		for(int i=0;i<c.size();i++)
		{
			if(c[i]=='b'||c[i+1]=='o'||c[i+2]=='y')
			{
				a++;
			}
			if(c[i]=='g'||c[i+1]=='i'||c[i+2]=='r'||c[i+3]=='l')
			{
				b++;
			}
		}
		cout<<a<<endl<<b<<endl;
		system("pause");
		return 0;
	} 